package com.mallcloud.mall.app.api.entity.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Optional;

@ApiModel(value = "ProXglSendSaleHead", description = "销售数据上传")
@Data
@ToString
public class ProXglSendSaleHead implements Serializable {
	private static final long serialVersionUID = 1L;

	@NotBlank(message = "门店不能为空")
    @ApiModelProperty("门店")
    private String storeNo;
	@NotBlank(message = "POS终端号不能为空")
    @ApiModelProperty("POS终端号")
    private String posKey;
	@NotBlank(message = "交易时间不能为空")
    @ApiModelProperty("交易时间")
    private String saleTime;
    @ApiModelProperty("顾客手机号码")
    private String phone;
    @ApiModelProperty("应收金额")
    private String totalMoney;
    @ApiModelProperty("实际付款")
    private String finalPayMoney;
    @ApiModelProperty("找零")
    private String changeAmount;

    @ApiModelProperty("过程返回id")
	private Integer messageId;
    @ApiModelProperty("过程返回信息")
    private String message;
    @ApiModelProperty("销售序号")
    private String billNo;

	public boolean isSuccess() {
		return Optional.ofNullable(this.messageId).map(x -> x.equals(0)).orElse(false);
	}

	private String orderNo;
}
